package com.volc.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.volc.common.po.ResponseBody;
import com.volc.common.po.ResponseCode;
import com.volc.mapper.db1.account.AccountMapper;
import com.volc.mapper.db2.account.Db2AccountMapper;
import com.volc.po.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class IndexController {

    @Autowired
    private AccountMapper accountMapper;

    @Autowired
    private Db2AccountMapper db2AccountMapper;

    @GetMapping("/findDb1Account")
    public ResponseBody findDb1Account() {
        QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
        List<Account> accounts = accountMapper.selectList(queryWrapper);
        return ResponseBody.success(ResponseCode.OK.MSG, accounts);
    }

    @GetMapping("/findDb2Account")
    public ResponseBody findDb2Account() {
        QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
        List<Account> accounts = db2AccountMapper.selectList(queryWrapper);
        return ResponseBody.success(ResponseCode.OK.MSG, accounts);
    }
}